<template>
    <h1>姓名：{{obj.name}}</h1>
    <h1>年龄：{{obj.age}}</h1>
    <h1>ref的数据:{{ ref_a }}</h1>
    <h1 v-for="(itme,index) in arr" :key="index">{{ itme.xiami }}</h1>
    <hr>
    <button @click="btn">点击更新视图层</button>
 </template>
 <script>
 import {ref,toRef} from 'vue'//组合式API
 export default({
     setup(){
        const obj = {name:'马云',age:50}
        const res = toRef(obj,'name')
        const ref_a = ref(0)
         function btn(){
                res.value = '马化腾'
                ref_a.value++
         }
         return{
            obj,btn,ref_a
         }
     }
 })
 </script>
 <style>
 </style>